package com.example.zyh.mapper;


import com.example.zyh.pojo.Home;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface HomeMapper {

    @Select("select * from home")
    public List<Home> select();
    @Insert("INSERT INTO home( `number`, `build`, `louceng`, `wmeter`, `wlocation`, `emeter`, `elocation`, `area`, `carea`, `state`, `sit`, `intime`, `totime`)\n" +
            "VALUES( #{number}, #{build}, #{louceng}, #{wmeter}, #{wlocation}, #{emeter}, #{elocation}, #{area},#{carea},#{state},#{sit},#{intime},#{totime})")
    public void add(Home home);
    @Delete("delete from home where id=#{id}")
    public void delete(int id);
    @Select("select * from home where id=#{id}")
    public Home getbyid(Home home);
    @Update("UPDATE home SET `number` = #{number} , `build` = #{build} , `louceng` = #{louceng} , `wmeter` = #{wmeter} , `wlocation` = #{wlocation} , `emeter` = #{emeter} , `elocation` =#{elocation}, \n" +
            "\t`area` = #{area} , `carea` = #{carea} , `state` = #{state}, `sit` = #{sit}, `intime` = #{intime} , `totime` = #{totime} WHERE `id` = #{id} ;\n")
    public void update(Home home);
    @Select("SELECT * FROM home WHERE number=#{number} OR build=#{build} OR louceng=#{louceng}")
    public List<Home> selectlike(Home home);
}
